﻿Imports System.Data.SqlClient
Imports CrystalDecisions.Shared

Public Class Form_Principal

    Private logica As New Logica

    Private Sub Form_Principal_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Cbox_Banco.Items.Add("Scotiabank")
        Cbox_Banco.Items.Add("Itaú")

    End Sub


    Private Sub Cbox_Banco_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cbox_Banco.SelectedIndexChanged

        If Cbox_Banco.SelectedIndex = 1 Then
            PictureBox2.Image = My.Resources.itauu
        ElseIf Cbox_Banco.SelectedIndex = 0 Then
            PictureBox2.Image = My.Resources.scotiabank
        End If

    End Sub

    Private Sub Btn_Generar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Generar.Click

        Dim repcheque As New rptCheques
        Dim FechaDV, CtaDV As New ParameterDiscreteValue
        Dim cuenta As String

        repcheque.DataSourceConnections(0).SetConnection("192.168.0.100", "recmetal", "false")
        repcheque.SetDatabaseLogon("recselect", "r3cs3l3ct")
        FechaDV.Value = Calendario.Value
        repcheque.SetParameterValue("@FechaVencimiento", FechaDV)

        If Cbox_Banco.SelectedIndex = 0 Then
            cuenta = "1-1-010-20-002"
        ElseIf Cbox_Banco.SelectedIndex = 1 Then
            cuenta = "1-1-010-20-001"
        End If

        CtaDV.Value = cuenta
        repcheque.SetParameterValue("@Banco", CtaDV)

        CrystalReportViewer1.ReportSource = repcheque

    End Sub
End Class
